package cn.wh.db.router;



/**
 * @Author wh
 * @Description 数据源上下文
 * @Date 2023/3/28 13:51
 * @Version 1.0
 **/
public class DBContextHolder {

    private static final ThreadLocal<String> dbKey=new ThreadLocal<>();

    private static final ThreadLocal<String> tbKey=new ThreadLocal<>();


    public static void setDBKey(String dbKeyIdx){
        dbKey.set(dbKeyIdx);
    }

    public static String getDBKey(){
        return dbKey.get();
    }

    public static void setTBKey(String tbKeyIdx){
        tbKey.set(tbKeyIdx);
    }

    public static String getTBKey(){
        return tbKey.get();
    }

    public static void clearDBKey(){
        dbKey.remove();
    }

    public static void clearTBKey(){
        tbKey.remove();
    }



}
